"""Definition of the Suporte content type
"""

from zope.app.component.hooks import getSite
from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import folder
from Products.ATContentTypes.content import schemata

from AccessControl import ClassSecurityInfo

from cintra.types.content import cintrauser
from cintra.types.interfaces import ISuporte
from cintra.types.config import PROJECTNAME
from cintra.types.content.schemas.suporte import SuporteSchema

from cintra.policy.utils.roles import SUPORTE_GROUP


class Suporte(cintrauser.CINTRAUser):
    """Suporte type for Cintra website"""
    implements(ISuporte)

    meta_type = "Suporte"
    schema = SuporteSchema
    
    security = ClassSecurityInfo()    
    
    def getGroup(self):
        return SUPORTE_GROUP    

    def get_home_url(self):
        portal = getSite()
        return portal.absolute_url_path() + '/view'


    def at_post_create_script(self):
        cintrauser.CINTRAUser.at_post_create_script(self)
#        self.setSignPassword('senha1') 


atapi.registerType(Suporte, PROJECTNAME)
